package com.jackstraw.jack_base.mq.rocketmq.bean;

import com.jackstraw.jack_base.mq.common.entity.MQConsumer;
import lombok.Data;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.SelectorType;

import java.util.HashMap;
import java.util.Map;

@Data
public class RocketMqConsumer extends MQConsumer {

    /**
     * Topic name
     */
    private String topic;

    /**
     * 控制消息方式，如果想让所有订阅者收到所有消息，广播是一个不错的选择。
     * CLUSTERING  聚集
     * BROADCASTING 广播
     * <p>
     * MessageModel下枚举值
     * <p>
     * Control message mode, if you want all subscribers receive message all message, broadcasting is a good choice.
     */
    private MessageModel messageModel = MessageModel.CLUSTERING;

    /**
     * 控制如何选择消息。
     * <p>
     * SelectorType下枚举值
     * <p>
     * Control how to selector message.
     */
    private SelectorType selectorType = SelectorType.TAG;

    /**
     * Control which message can be select.
     * <p>
     * 控制可以选择的消息。
     */
    private String selectorExpression = "*";

    /**
     * “access-key”的属性。
     * <p>
     * The property of "access-key".
     */
    private String accessKey;

    /**
     * “secret-key”的属性。
     * <p>
     * The property of "secret-key".
     */
    private String secretKey;

    /**
     * 每次提取的最大消息数。
     * <p>
     * Maximum number of messages pulled each time.
     */
    private int pullBatchSize = 10;

    /**
     * 侦听器配置容器
     * 模式是这样的:
     * group1.topic1 = false
     * group2.topic2 = true
     * group3.topic3 = false
     * <p>
     * listener configuration container
     * the pattern is like this:
     * group1.topic1 = false
     * group2.topic2 = true
     * group3.topic3 = false
     */
    private Map<String, Map<String, Boolean>> listeners = new HashMap<>();
}
